package com.mgwt.mobile.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Widget;
import com.google.web.bindery.event.shared.binder.EventBinder;
import com.google.web.bindery.event.shared.binder.EventHandler;
import com.googlecode.mgwt.dom.client.event.tap.TapEvent;
import com.googlecode.mgwt.mvp.client.Animation;
import com.googlecode.mgwt.ui.client.widget.LayoutPanel;
import com.mgwt.mobile.client.events.ShowLoginEvent;
import com.mgwt.mobile.client.events.ShowRegisterConfirmedEvent;

public class RegisterConfirmedPanel extends LayoutPanel {

	interface MyEventBinder extends EventBinder<RegisterConfirmedPanel> {
	}

	private static final MyEventBinder eventBinder = GWT.create(MyEventBinder.class);

	interface RegisterConfirmedPanelUiBinder extends UiBinder<Widget, RegisterConfirmedPanel> {
	}

	private static RegisterConfirmedPanelUiBinder uiBinder = GWT.create(RegisterConfirmedPanelUiBinder.class);

	public RegisterConfirmedPanel() {
		eventBinder.bindEventHandlers(this, Eventor.getInstance());

		add(uiBinder.createAndBindUi(this));
	}

	@UiHandler("backButton")
	void handleBackButton(TapEvent e) {
		Eventor.getInstance().fireEvent(new ShowLoginEvent());
	}

	@EventHandler
	void onShowRegisterConfirmed(ShowRegisterConfirmedEvent event) {
		Animator.getInstance().goTo(this, Animation.FLIP_REVERSE);
	}

}
